package com.wxy.config;

import com.zaxxer.hikari.HikariDataSource;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;
import java.sql.SQLException;

//@Configuration
public class DataSourceConfig {

    String url = "jdbc:mysql://127.0.0.1:3309/db_lowcode?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&pinGlobalTxToPhysicalConnection=true&useSSL=false";
    String user = "root";
    String password = "123456";

    public DataSource dataSource() throws SQLException {
        HikariDataSource dataSource = new HikariDataSource();
        dataSource.setJdbcUrl(url);
        dataSource.setUsername(user);
        dataSource.setPassword(password);
        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        return dataSource;
    }
}
